<?php
class Message {

    public $flag =0;
    public $message="";
    public $code="";
    public $saveFlag =0;
    public $success = true;
    public $failure = false;

    public function Message($c="",$m="",$f=0){
    	$this->message =$m;	
    	$this->code =$c;
        $this->flag = $f;
        
    	if($this->message!=null && $this->message!=""){
            $this->failure = true;
            $this->success = false;

    	}
    }

    public function setException($ex){
        $this->flag=$ex->getCode();
        $this->message=$ex->getMessage();
        $this->failure = true;
        $this->success = false;
    }

    public function toJson(){

		echo json_encode($this);     	
    }

}
?>